package com.guomao.filedemos;

import java.io.File;

public class FileDemoK {


    public static void main(String[] args) {


        String path = "D://";
//        File file = new File(path);

        printJavaFilePath(new File(path));
//        File[] files = file.listFiles();
//        for (File f : files) {
//            System.out.println(f);
//        }
//
//        printJavaFilePath(new File(path));

    }

    public static void printJavaFilePath(File path) {

        File[] files = path.listFiles();
        //如果当前file下有子文件或者有子目录
        if (files != null && files.length > 0) {
            for (File file : files) {
                if (file.isDirectory()) {
                    printJavaFilePath(file);
                } else if (file.isFile()) {

                    if (file.getName().contains("微服务")) {
                        System.out.println(file.getAbsolutePath());
                    }
                }
            }
        }
    }
}
